import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import './assets/tailwind.css'


// 引入阿里巴巴矢量图标库
import './assets/iconfont/iconfont.css'

// 引入Element Plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// 全局注册工具类
import { formatDate } from './utils/date'

// 引入用户状态管理
import { useUserStore } from './stores/user'

const app = createApp(App)
const pinia = createPinia()

// 初始化用户信息
const userStore = useUserStore(pinia)
userStore.initUserInfo()

// 全局过滤器
app.config.globalProperties.$filters = {
  formatDate(dateString, format = 'yyyy-MM-dd HH:mm:ss') {
    return formatDate(dateString, format)
  }
}

app.use(router)
app.use(ElementPlus)
app.use(pinia)

app.mount('#app')